<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The EventSslContext class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="eventlistener.seterrorcallback.html">« EventListener::setErrorCallback</a></li>
      <li style="float: right;"><a href="eventsslcontext.construct.html">EventSslContext::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.event.html">Event</a></li>
    <li>The EventSslContext class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.eventsslcontext" class="reference">
 <h1 class="title">The EventSslContext class</h1>
 
 <div class="partintro"><p class="verinfo">(PECL event &gt;= 1.2.6-beta)</p>

  <div class="section" id="eventsslcontext.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Represents
    <code class="literal">SSL_CTX</code>
    structure. Provides methods and properties to configure the SSL context.
   </p>
  </div>

  <div class="section" id="eventsslcontext.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <strong class="classname">EventSslContext</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv2-client-method"><var class="varname">SSLv2_CLIENT_METHOD</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv3-client-method"><var class="varname">SSLv3_CLIENT_METHOD</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv23-client-method"><var class="varname">SSLv23_CLIENT_METHOD</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.tls-client-method"><var class="varname">TLS_CLIENT_METHOD</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv2-server-method"><var class="varname">SSLv2_SERVER_METHOD</var></a></var><span class="initializer"> = 5</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv3-server-method"><var class="varname">SSLv3_SERVER_METHOD</var></a></var><span class="initializer"> = 6</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.sslv23-server-method"><var class="varname">SSLv23_SERVER_METHOD</var></a></var><span class="initializer"> = 7</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.tls-server-method"><var class="varname">TLS_SERVER_METHOD</var></a></var><span class="initializer"> = 8</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-local-cert"><var class="varname">OPT_LOCAL_CERT</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-local-pk"><var class="varname">OPT_LOCAL_PK</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-passphrase"><var class="varname">OPT_PASSPHRASE</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-ca-file"><var class="varname">OPT_CA_FILE</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-ca-path"><var class="varname">OPT_CA_PATH</var></a></var><span class="initializer"> = 5</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-allow-self-signed"><var class="varname">OPT_ALLOW_SELF_SIGNED</var></a></var><span class="initializer"> = 6</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-verify-peer"><var class="varname">OPT_VERIFY_PEER</var></a></var><span class="initializer"> = 7</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-verify-depth"><var class="varname">OPT_VERIFY_DEPTH</var></a></var><span class="initializer"> = 8</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.eventsslcontext.html#eventsslcontext.constants.opt-ciphers"><var class="varname">OPT_CIPHERS</var></a></var><span class="initializer"> = 9</span>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.eventsslcontext.html#eventsslcontext.props.local-cert">$<var class="varname">local_cert</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.eventsslcontext.html#eventsslcontext.props.local-pk">$<var class="varname">local_pk</var></a></var>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">__construct</a></span>(<span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$method</code>
   </span>, <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$options</code>
   </span>)</div>

   }</div>

  </div>

  <div class="section" id="eventsslcontext.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="eventsslcontext.props.local-cert">
      <var class="varname">local_cert</var>
     </dt>

     <dd>

      <p class="para">
       Path to local certificate file on filesystem. It must be a PEM-encoded
       file which contains certificate. It can optionally contain the
       certificate chain of issuers.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.props.local-pk">
      <var class="varname">local_pk</var>
     </dt>

     <dd>

      <p class="para">
       Path to local private key file
      </p>
     </dd>

    
   </dl>

  </div>


  <div class="section" id="eventsslcontext.constants">
   <h2 class="title">预定义常量</h2>
   <dl>
    
     <dt id="eventsslcontext.constants.sslv2-client-method">
      <strong><code>EventSslContext::SSLv2_CLIENT_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv2 client method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.sslv3-client-method">
      <strong><code>EventSslContext::SSLv3_CLIENT_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv3 client method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.sslv23-client-method">
      <strong><code>EventSslContext::SSLv23_CLIENT_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv23 client method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.tls-client-method">
      <strong><code>EventSslContext::TLS_CLIENT_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       TLS client method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.sslv2-server-method">
      <strong><code>EventSslContext::SSLv2_SERVER_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv2 server method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.sslv3-server-method">
      <strong><code>EventSslContext::SSLv3_SERVER_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv3 server method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.sslv23-server-method">
      <strong><code>EventSslContext::SSLv23_SERVER_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       SSLv23 server method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.tls-server-method">
      <strong><code>EventSslContext::TLS_SERVER_METHOD</code></strong>
     </dt>

     <dd>

      <p class="para">
       TLS server method. See
       <code class="literal">SSL_CTX_new(3)</code>
       man page.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-local-cert">
      <strong><code>EventSslContext::OPT_LOCAL_CERT</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . The option points to path of local certificate.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-local-pk">
      <strong><code>EventSslContext::OPT_LOCAL_PK</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . The option points to path of the private key.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-passphrase">
      <strong><code>EventSslContext::OPT_PASSPHRASE</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents passphrase of the certificate.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-ca-file">
      <strong><code>EventSslContext::OPT_CA_FILE</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents path of the certificate authority file.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-ca-path">
      <strong><code>EventSslContext::OPT_CA_PATH</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents path where the certificate authority file should be
       searched for.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-allow-self-signed">
      <strong><code>EventSslContext::OPT_ALLOW_SELF_SIGNED</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents option that allows self-signed certificates.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-verify-peer">
      <strong><code>EventSslContext::OPT_VERIFY_PEER</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents option that tells Event to verify peer.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-verify-depth">
      <strong><code>EventSslContext::OPT_VERIFY_DEPTH</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents maximum depth for the certificate chain verification that
       shall be allowed for the SSL context.
      </p>
     </dd>

    
    
     <dt id="eventsslcontext.constants.opt-ciphers">
      <strong><code>EventSslContext::OPT_CIPHERS</code></strong>
     </dt>

     <dd>

      <p class="para">
       Key for an item of the options&#039; array used in
       <span class="methodname"><a href="eventsslcontext.construct.html" class="methodname">EventSslContext::__construct()</a></span>
       . Represents the cipher list for the SSL context.
      </p>
     </dd>

    
   </dl>

  </div>

 </div>

 






<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="eventsslcontext.construct.html">EventSslContext::__construct</a> — Constructs an OpenSSL context for use with Event classes</li></ul>
</div>
</div></div></body></html>